package com.hazardSoft.eStore.entities;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import com.hazardSoft.eStore.utils.QueryConstants;

@Entity
@NamedQueries({
	@NamedQuery(name = QueryConstants.QUERY_LIST_INVENTORIES, query = "FROM Inventory"),
	@NamedQuery(name = QueryConstants.QUERY_SEARCH_INVENTORY, query = "FROM Inventory inv WHERE inv.product=?1 and inv.office=?2"),
	@NamedQuery(name = QueryConstants.QUERY_SEARCH_INVENTORIES_BY_OFFICE, query = "FROM Inventory inv WHERE inv.office=?1"),
	@NamedQuery(name = QueryConstants.QUERY_SEARCH_INVENTORIES_BY_PRODUCT, query = "FROM Inventory inv WHERE inv.product=?1")
})
public class Inventory implements Serializable {
	@Id
	private Integer id;

	private Integer quantity;

	@ManyToOne
	@JoinColumn(name="product")
	private Product product;

	@ManyToOne
	@JoinColumn(name="office")
	private Office office;

	private static final long serialVersionUID = 1L;

	public Inventory() {
		super();
	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getQuantity() {
		return this.quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

	public Product getProduct() {
		return this.product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public Office getOffice() {
		return this.office;
	}

	public void setOffice(Office office) {
		this.office = office;
	}

}
